package com.tcwlkj.uuService.utils;

import android.view.View;

import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
import com.lcodecore.tkrefreshlayout.footer.LoadingView;
import com.lcodecore.tkrefreshlayout.header.SinaRefreshView;
import com.lcodecore.tkrefreshlayout.header.progresslayout.ProgressLayout;
import com.tcwlkj.uuService.MyApp;
import com.tcwlkj.uuService.R;


/**
 * Created by Administrator on 2017/10/13 0013.
 */

public class MyRefresh {

    private static class Holder {
        private static final MyRefresh instance = new MyRefresh();
    }

    public static MyRefresh getInstance() {
        return Holder.instance;
    }

    public void getMyRefresh(TwinklingRefreshLayout refresh, boolean isModeOn) {//下拉加载
        SinaRefreshView headerView = new SinaRefreshView(MyApp.getContext());
        headerView.setArrowResource(R.mipmap.arrow);
        headerView.setTextColor(0xff745D5C);
        //        TextHeaderView headerView = (TextHeaderView) View.inflate(this,R.layout.header_tv,null);
        refresh.setHeaderView(headerView);
        LoadingView loadingView = new LoadingView(MyApp.getContext());
//        loadingView.setBackground(BaseActivity.mActivity.getDrawable(R.mipmap.s15));
//        loadingView.setScaleX(0.5f);
//        loadingView.setScaleY(0.5f);
        refresh.setBottomView(loadingView);

        if (isModeOn)
            refresh.setPureScrollModeOn();

    }

    public void getDefRefresh(TwinklingRefreshLayout refresh, boolean isModeOn) {//默认多个点

    }

    public void getMusic(TwinklingRefreshLayout refresh, boolean isModeOn){//圆圈圈
        ProgressLayout headerView= new ProgressLayout(MyApp.getContext());
        refresh.setHeaderView(headerView);
        refresh.setOverScrollRefreshShow(false);
        //refresh.setEnableLoadmore(false);

        LoadingView loadingView = new LoadingView(MyApp.getContext());
        refresh.setBottomView(loadingView);
        if(isModeOn)
            refresh.setPureScrollModeOn();
    }

    public void getoneMusic(TwinklingRefreshLayout refresh, boolean isModeOn){//圆圈圈
        ProgressLayout headerView= new ProgressLayout(MyApp.getContext());
        refresh.setHeaderView(headerView);
        refresh.setOverScrollRefreshShow(false);
        refresh.setEnableLoadmore(false);
        if(isModeOn)
            refresh.setPureScrollModeOn();
    }
}

